@echo off
cls

set mode=%1

if /i "%mode%"=="debug" (
	goto debug
)

if /i "%mode%"=="release" (
	goto release
)


REM :: No configuration mode specified, assuming release
set mode=release
goto release


:debug
echo Building Gimme in DEBUG mode...
echo.
echo 1. Merging Gimme source into file: gimme.js
echo.
ruby -s .\utils\ruby\merge.rb -buildfile=.\gimme.build -outputfile=.\build\debug\gimme.js
echo.
goto end


:release
echo Building Gimme in RELEASE mode...
echo.
echo 1. Merging Gimme source into temp file: gimme_tmp.js
ruby -s .\utils\ruby\merge.rb -buildfile=.\gimme.build -outputfile=.\build\release\gimme_tmp.js
echo.
echo 2. Crunching gimme_tmp.js into gimme.js

REM :: Need to find a utility other than JsCrunch.exe -- something open source that can be freely distributed with Gimme
.\utils\win\jscrunch.exe .\build\release\gimme_tmp.js -H -G:Gimme,g -O .\build\release\gimme.js

echo.
echo 3. Removing tmp file: gimme_tmp.js
del .\build\release\gimme_tmp.js /s
echo.
goto end

:end
echo.Build completed!
echo.Output file available at: (.\build\%mode%\gimme.js)